<template>
    <div>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>房型名称</td>
                    <td><input type="text" v-model="add.name"></td>
                </tr>
                <tr>
                    <td>门市价格</td>
                    <td><input type="text" v-model="add.money"></td>
                </tr>
                <tr>
                    <td>房间号</td>
                    <td>
                        <input type="checkbox" v-model="add.num" name="num" value="1001">1001
                        <input type="checkbox" v-model="add.num" name="num" value="1002">1002
                        <input type="checkbox" v-model="add.num" name="num" value="1003">1003
                        <input type="checkbox" v-model="add.num" name="num" value="1004">1004
                        <input type="checkbox" v-model="add.num" name="num" value="1005">1005
                        <input type="checkbox" v-model="add.num" name="num" value="1006">1006
                        <input type="checkbox" v-model="add.num" name="num" value="1007">1007
                        <input type="checkbox" v-model="add.num" name="num" value="1008">1008
                        <input type="checkbox" v-model="add.num" name="num" value="1009">1009
                        <input type="checkbox" v-model="add.num" name="num" value="1000">1000
                    </td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td>
                        <input type="radio" value="启用" name="tyle" v-model="add.tyle">启用
                        <input type="radio" value="停用" name="tyle" v-model="add.tyle">停用
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="button" value="添加" @click="ok"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref, reactive, onMounted } from "vue";
import moment from 'moment';
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const route = useRoute();

let add: any = reactive(
    {
        "name": "",
        "money": "",
        "num": [],
        "shu": 0,
        "tyle": "",
        "isdel": true
    }
)
const ok = () => {
    add.shu = add.num.length;
    add.num = add.num.toString();
    axios({
        url: 'https://localhost:7200/api/Emp/add',
        method: 'post',
        data: add
    })
        .then(res => {
            console.log(res);
            if (res.data > 0) {
                alert("添加成功");
            }
        })
        .catch(err=>{
            console.log(err);
            
        })
}
</script>

<style scoped></style>